AR Clip SDK
Overview
AR Clip lets you deliver App Clip–powered AR experiences that stream WebGL content while relying on ARKit and the AR Clip VPS engine for localization. Follow the Immersal-style flow below: verify prerequisites, add the package, prepare the scene, enable VPS, and upload the WebGL build.
Prerequisites
- Unity 2020 LTS or newer (tested with 2021+)
- WebGL build target
- Access to the AR Clip zip uploader (https://cdn.mobile.web-ar.studio/clip/pages/zip_uploader.html)
Testing note: In the Unity Editor most AR Clip APIs are wrapped with
Application.isEditor. Build WebGL content and test it via the AR Clip mobile app for real tracking.
Install the Package
- Open Window → Package Manager.
- Click + → Add package from Git URL….
- Paste
https://github.com/WebAR-Studio/arclip_sdk.gitand confirm.
Before importing, remove any legacy Assets/ARLib folder to avoid duplicate symbol errors such as:
error CS0433: The type 'ARLibTester' exists in both 'ARLib' and 'Assembly-CSharp'
Import samples
From Package Manager → AR Clip → Samples:
- Import WebGLTemplates and copy the resulting folder into
Assets/(root) so it appears under Project Settings → Player → WebGL Template. - Import TransparentBackground and move
TransparentBackground.jslibtoAssets/Plugins. This enables transparent rendering in WebGL.
Scene Setup
- Add an empty GameObject named
ARClipController. - Attach
ARLibControllerand assign a camera to therenderCamerafield. - Disable the Camera component on that GameObject, set Clear Flags = Solid Color, and use RGBA(0,0,0,0) for the background.
- Optional: Add
ARLibTester(from Samples) in the Editor to simulate native callbacks.
Minimal bootstrap script
using UnityEngine;
using ARLib;
public class ARClipBootstrap : MonoBehaviour
{
[SerializeField] private Camera renderCamera;
private void OnEnable()
{
ARLibController.Initialized += HandleInitialized;
ARLibController.VPSPositionUpdated += HandleVpsPose;
}
private void OnDisable()
{
ARLibController.Initialized -= HandleInitialized;
ARLibController.VPSPositionUpdated -= HandleVpsPose;
}
private void Start()
{
ARLibController.SetRenderCamera(renderCamera);
ARLibController.Initialize();
}
private void HandleInitialized()
{
ARLibController.EnableCamera();
ARLibController.EnableAR();
ARLibController.EnableSurfaceTracking("horizontal");
}
private void HandleVpsPose(VPSPoseData pose)
{
Debug.Log($"VPS pose: {pose.Position}");
}
}
Start VPS Localization
Configure VPS after initialization and before starting localization:
var settings = new VPSSettings
{
apiKey = "your-api-key",
locationIds = new[] { "your-location-id" }
};
ARLibController.SetupVPS(settings);
ARLibController.StartVPS();
Listen to:
ARLibController.VPSInitializedto know when the subsystem is ready.ARLibController.VPSPositionUpdatedfor localization poses.ARLibController.OnVPSErrorHappenedfor error strings.
Timing helpers such as SetSendPhotoDelay, SetGpsAccuracyBarrier, and SetFirstRequestDelay allow tuning request cadence for specific locations.
Tracking Modules
- Register images with
AddTrackingImagebefore enabling tracking. Wait forTrackedImagesArrayUpdateto confirm they loaded. - Call
EnableSurfaceTracking("horizontal" | "vertical" | "both")to detect planes. Results are dispatched throughSurfaceTrackingUpdated.
Build & Upload Workflow
- Select WebGL template: Under Project Settings → Player → WebGL → Resolution and Presentation, choose the template you copied from the package.
- Build: Use File → Build Settings → WebGL → Build.
- Zip: Compress the build output so
index.htmlresides at the zip root. - Upload: Submit the archive via https://cdn.mobile.web-ar.studio/clip/pages/zip_uploader.html.
- Test: Scan the generated QR code with the AR Clip iOS app (https://apps.apple.com/app/ar-clip/id6742754238).
Troubleshooting
- No camera feed in WebGL: ensure
TransparentBackground.jsliblives inAssets/Pluginsand the render camera is both assigned and disabled. - Editor play mode lacks AR events: this is expected. Use
ARLibTesteror build to WebGL for live data. - Duplicate symbol errors: confirm the legacy
ARLibfolder is removed before importing the package.